<?php

class GaAPI_Services_Accounts extends GaAPI_Services_Abstract {

    protected $_version = 'v13';
    protected $_serviceName = 'AccountService';

    public function getInfo() {
        $response = $this->call('getAccountInfo');
        $info = $response['getAccountInfoReturn'];

        $account = $this->newAccountInfo();
        $account->setFromArray($info);
        return $account;
    }

    public function getAll() {
        $response = $this->call('getClientAccounts');
        $emails = $response['getClientAccountsReturn'];

        return $emails;
    }

    public function getAllInfo() {
        $response = $this->call('getClientAccountInfos');
        $infos = $response['getClientAccountInfosReturn'];

        return $infos;
    }

    /**
     * @return GaAPI_Objects_Account_Info
     */
     public function newAccountInfo() {
        GaAPI_Autoloader::instance()->load('GaAPI_Objects_Account_Info');
        
        $account = new GaAPI_Objects_Account_Info();
        $account->setApi($this->getApi());
        return $account;
    }
}